package com.tool.resourcemapping;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 酒徒
 * @Version 1.0
 * @data 2024/1/23 20:59
 * 资源映射：当访问某一位置的资源是，转到映射的位置访问同名资源
 */
@Configuration
@Slf4j
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/picture/**").addResourceLocations("classpath:/static/img/");
    }
}
